#include <iostream>
#include <string>
using namespace std;
class Student {
private:
    string name;
    int age;
public:
    Student() : name("无名"), age(7) {}
    void setName(const string& studentName) {
        name = studentName;
    }
    void setAge(int studentAge) {
        age = (studentAge <= 6) ? 7 : studentAge;
    }
    void displayInfo() const {
        cout << "姓名: " << name << "年龄: " << age << endl;
    }
};
int main() {
    Student student1;
    student1.displayInfo();
    string inputName;
    int inputAge;
    while (true) {
        cout << "请输入学生姓名和年龄: ";
        cin >> inputName;
        if (inputName == "exit") {
            break;
        }
        cin >> inputAge;
        Student student2;
        student2.setName(inputName);
        student2.setAge(inputAge);
        student2.displayInfo();
    }
    return 0;
}
